package com.aeye.mbr.upms.dao.model;

import com.aeye.mbr.model.constant.UpmsDatabaseConstants;
import com.gitee.sunchenbin.mybatis.actable.annotation.DBColumn;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Table(name = UpmsDatabaseConstants.TABLE_AREA)
public class UpmsArea implements Serializable {
    /**
     * 编号
     *
     * @mbg.generated
     */
    @Id
    @DBColumn(type = MySqlTypeConstant.VARCHAR,length = 12,isKey = true)
    private String id;

    /**
     * 所属上级
     *
     * @mbg.generated
     */
    @DBColumn(type = MySqlTypeConstant.VARCHAR,length = 12)
    private String pid;

    /**
     * 组织名称
     *
     * @mbg.generated
     */
    @DBColumn(type = MySqlTypeConstant.VARCHAR,length = 20)
    private String name;

    @DBColumn(type = MySqlTypeConstant.INT,length = 2)
    private Integer level;

    /**
     * 组织描述
     *
     * @mbg.generated
     */
    @DBColumn(type = MySqlTypeConstant.VARCHAR,length = 64)
    private String description;

    /**
     * 全路径
     */
    @DBColumn(type = MySqlTypeConstant.VARCHAR,length = 256)
    private String path;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UpmsArea upmsArea = (UpmsArea) o;

        if (id != null ? !id.equals(upmsArea.id) : upmsArea.id != null) return false;
        if (pid != null ? !pid.equals(upmsArea.pid) : upmsArea.pid != null) return false;
        if (name != null ? !name.equals(upmsArea.name) : upmsArea.name != null) return false;
        if (level != null ? !level.equals(upmsArea.level) : upmsArea.level != null) return false;
        if (description != null ? !description.equals(upmsArea.description) : upmsArea.description != null)
            return false;
        return path != null ? path.equals(upmsArea.path) : upmsArea.path == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (pid != null ? pid.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (level != null ? level.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (path != null ? path.hashCode() : 0);
        return result;
    }
}